﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1 {
    public partial class _课堂练习1_confrim : System.Web.UI.Page {
        protected void Page_Load (object sender, EventArgs e) {
            if (Page.PreviousPage == null)
            {
                //入口错误时
                Response.Redirect("_课堂练习1.aspx");
            }


            if (Page.PreviousPage != null) //判断 前面传输也是否为空
            {

                if (Page.PreviousPage.IsCrossPagePostBack) //判断前页是否使用了跨页数据提交
                {

                    //这里我选择由上一个页面控制不要传递空值。
                    Label1.Text = "姓名：" + ((TextBox) Page.PreviousPage.FindControl ("TextBox1")).Text;
                    Label2.Text = "密码：" + ((TextBox) Page.PreviousPage.FindControl ("TextBox2")).Text;
                    Label3.Text = "安全问题：" + ((DropDownList) Page.PreviousPage.FindControl ("DropDownList1")).Text;
                    Label4.Text = "安全问题答案：" + ((TextBox) Page.PreviousPage.FindControl ("TextBox4")).Text;
                }
            }
        }


        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Write("<script> alert(\"注册成功！！\" )</script>");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            //重新填写
            //Response.Redirect("_课堂练习1.aspx");
        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            Response.Clear();
            Response.Write("<script> alert(\"注册成功！！\" )</script>");
        }
    }
}